/**
 * ImageUtils
 * 
 * 11/11/2013
 * 
 * Copyright GPL
 */
package com.jtmproject.classes;

import android.graphics.Bitmap;

/**
 * This class can manipulates images
 * @author Javier Tejedor
 */
public class ImageUtils {

	private static final int SCALED_SIZE = 512;
	public static ImageUtils imageUtils;

	/**
	 * This returns an instance of ImageUtils (Singleton Class)
	 * @return
	 */
	public static ImageUtils getImageUtils() {
		
		if(imageUtils == null){
			imageUtils = new ImageUtils();
		}
		
		return imageUtils;
	}
	
	
	/**
	 * returns an Bitmap scaled
	 * @param bitmap
	 * @return
	 */
	public Bitmap scaleBitmap(Bitmap bitmap){
		int scale = 
				(int) (bitmap.getHeight() * (SCALED_SIZE / bitmap.getWidth()));
		
		return Bitmap.createScaledBitmap(bitmap, SCALED_SIZE, scale, true);
	}
}
